home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / appletalk / netatalk / afs / afskrbsrc.sit.hqx / AFS Kerberos 1.0B0 / bsd / bsd-mac-compat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-17  |  2.3 KB  |  94 lines

  1. /*
  2.  * $Source: /afs/athena.mit.edu/user/j/jon/mac/MIT/CIncludes/bsd/RCS/bsd-mac-compat.h,v $
  3.  * $Author: jon $
  4.  * $Header: /afs/athena.mit.edu/user/j/jon/mac/MIT/CIncludes/bsd/RCS/bsd-mac-compat.h,v 1.6 90/03/16 21:40:10 jon Exp $
  5.  *
  6.  * Copyright 1989 by the Massachusetts Institute of Technology.
  7.  *
  8.  * For copying and distribution information, please see the file
  9.  * <mit-copyright.h>.
  10.  *
  11.  * Machine-type definitions: Mac with MPW C.
  12.  */
  13.  
  14. #ifndef _BSD_MAC_COMPAT_
  15. #define _BSD_MAC_COMPAT_
  16.  
  17. #ifndef MacOS
  18. #define MacOS
  19. #endif
  20.  
  21. /* Berkeley type string functions */
  22. #define bcmp memcmp
  23. #define bzero(ptr, len) memset ((ptr), 0, (len))
  24. #define index strchr
  25. #define rindex strrchr
  26. #define bcopy(s,d,n) memcpy(d,s,n)
  27.  
  28. #include <String.h>;
  29.  
  30. #include <Fcntl.h>;
  31. #include <Stdio.h>;
  32. #include <Errno.h>;
  33.  
  34. #define getuid() 0
  35.  
  36. #define u_long unsigned long
  37. #define u_short unsigned short
  38. #define caddr_t char *
  39. #define u_char unsigned char
  40.  
  41. #define uid_t unsigned short
  42. #define gid_t unsigned short
  43. #define off_t long int
  44.  
  45. /* from <sys/param.h> */
  46. #define MAXPATHLEN 1024 
  47.  
  48. #include "bsd-netinet-in.h"
  49. #include "bsd-netdb.h"
  50. #include "bsd-arpa-inet.h"
  51. #include "bsd-sys-socket.h"
  52.  
  53. struct timeval {long tv_sec; long tv_usec;};
  54. struct timezone {int    tz_minuteswest;    int    tz_dsttime;};
  55.  
  56. #include <Time.h>
  57.  
  58. /* BSD errno.h additions (network, socket) */
  59. #include "bsd-errno.h"
  60.  
  61. #define write(fd, buf, len) socket_write(fd, buf, len)
  62. #define read(fd, buf, len) socket_read(fd, buf, len)
  63. #define close(fd) socket_close(fd)
  64.  
  65. /* for select */
  66.  
  67. #define    NBBY    8        /* number of bits in a byte */
  68. /*
  69.  * Select uses bit masks of file descriptors in longs.
  70.  * These macros manipulate such bit fields (the filesystem macros use chars).
  71.  * FD_SETSIZE may be defined by the user, but the default here
  72.  * should be >= NOFILE (param.h).
  73.  */
  74. #ifndef    FD_SETSIZE
  75. #define    FD_SETSIZE    256
  76. #endif
  77.  
  78. typedef long    fd_mask;
  79. #define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  80. #ifndef howmany
  81. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  82. #endif
  83.  
  84. typedef    struct fd_set {
  85.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  86. } fd_set;
  87.  
  88. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  89. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  90. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  91. #define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  92.  
  93. #endif /* _BSD_MAC_COMPAT_ */
  94.